package hello.test;

import static org.junit.Assert.*;
import hello.A11StringUtil;

import org.junit.Test;

public class CountCharater {

	@Test
	public void strIsNull() {
		assertEquals(0, A11StringUtil.countChar(null, 'b'));
	}

	@Test(expected = exception.ExceptionStringIsEmpty.class)
	public void strIsEmpty() {
		assertEquals(0, A11StringUtil.countChar(new String(), 'b'));
	}

	@Test(expected = exception.ExceptionCharIsNotDefine.class)
	public void charIsOutRange() {
		assertEquals(0, A11StringUtil.countChar("avd ", ' '));
	}

	@Test
	public void normal() {
		assertEquals(3, A11StringUtil.countChar("Hello world", 'l'));
	}

}
